﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
//using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace netsoul
{
    public partial class FrmDetail : Form
    {
        Netsoul net;

        public FrmDetail(Netsoul ns)
        {
            net = ns;
            InitializeComponent();
        }

        private void btn_refresh_Click(object sender, EventArgs e)
        {
            if (txt_login.Text.Trim().Length <= 0)
                return;

            string cmd = "list_users " + txt_login.Text.Trim() + "\n";
            net.SendCmd(cmd);
            Thread.Sleep(100);
            cmd = net.GetCmd();
            string[] cmdtab = cmd.Split('\n');
            for (int i = 0; i < cmdtab.Length; i++)
            {
                if (cmdtab[i].Trim().StartsWith("rep 002") == true)
                {
                    lst_detail.Items.Add("Hors Ligne");
                    return;
                }
                string[] info = cmdtab[i].Trim().Split(' ');
                for (int j = 0; j < info.Length; j++)
                {
                    lst_detail.Items.Add(info[j].Trim().ToString());
                }
            }
            //lst_detail.Items.Add("Hors Ligne");
        }
    }
}
